<?php
	$id = $_GET["id"];
	$like = $_GET["like"];
	$change = $_GET["change"];
	
	if (strcmp($change,'up')==0) {
		$like = $like + 1;
	}
	else {
		$like = $like - 1;
	}

	$con = mysql_connect("localhost","progin","progin");
				
	if (!$con) {
		die('Could not connect: ' . mysql_error());
	}

	mysql_select_db("progin_171_13509045", $con) or die("Cannot find database");
	
	$sql = "UPDATE konten SET jumlahlike='$like' WHERE id_konten='$id'";
	$result = mysql_query($sql);
	$sql = "SELECT jumlahlike FROM konten WHERE id_konten='$id'";
	$result = mysql_query($sql);
	
	while ($row = mysql_fetch_array($result)) {
		echo $row['jumlahlike'];
		print ' likes';
	}
	
	mysql_close($con);
?>